using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class locales_page_text : MangosBase
	{
		public System.UInt32? entry;
		public System.String text_loc1;
		public System.String text_loc2;
		public System.String text_loc3;
		public System.String text_loc4;
		public System.String text_loc5;
		public System.String text_loc6;
		public System.String text_loc7;
		public System.String text_loc8;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `locales_page_text` (`entry`, `text_loc1`, `text_loc2`, `text_loc3`, `text_loc4`, `text_loc5`, `text_loc6`, `text_loc7`, `text_loc8`) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}');", entry.GetValueOrDefault(), text_loc1.MySQLDBString(), text_loc2.MySQLDBString(), text_loc3.MySQLDBString(), text_loc4.MySQLDBString(), text_loc5.MySQLDBString(), text_loc6.MySQLDBString(), text_loc7.MySQLDBString(), text_loc8.MySQLDBString());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `locales_page_text` SET ");
			if(text_loc1 != null)
			{
				sb.AppendLine("`text_loc1`='" + text_loc1.MySQLDBString() + "'");
			}
			if(text_loc2 != null)
			{
				sb.AppendLine("`text_loc2`='" + text_loc2.MySQLDBString() + "'");
			}
			if(text_loc3 != null)
			{
				sb.AppendLine("`text_loc3`='" + text_loc3.MySQLDBString() + "'");
			}
			if(text_loc4 != null)
			{
				sb.AppendLine("`text_loc4`='" + text_loc4.MySQLDBString() + "'");
			}
			if(text_loc5 != null)
			{
				sb.AppendLine("`text_loc5`='" + text_loc5.MySQLDBString() + "'");
			}
			if(text_loc6 != null)
			{
				sb.AppendLine("`text_loc6`='" + text_loc6.MySQLDBString() + "'");
			}
			if(text_loc7 != null)
			{
				sb.AppendLine("`text_loc7`='" + text_loc7.MySQLDBString() + "'");
			}
			if(text_loc8 != null)
			{
				sb.AppendLine("`text_loc8`='" + text_loc8.MySQLDBString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `entry`='" + entry.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
